-
Notifications
You must be signed in to change notification settings - Fork 405
feat: better unknown account error #4166
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
🛠 PR Checks SummaryAll Automated Checks passed. ✅ Manual Checks (for Reviewers):
Read More🤖 This bot helps streamline PR reviews by verifying automated checks and providing guidance for contributors and reviewers. ✅ Automated Checks (for Contributors):🟢 Maintainers must be able to edit this pull request (more info) ☑️ Contributor Actions:
☑️ Reviewer Actions:
📚 Resources:Debug
|
Codecov ReportAttention: Patch coverage is
📢 Thoughts on this report? Let us know! |
This PR covers Run & AddPkg messages; if the case I listed here is correct, we can change all occurences of the error in question to something better. If not, I'll let someone else with more context handle this issue |
@@ -336,7 +336,7 @@ func (vm *VMKeeper) AddPackage(ctx sdk.Context, msg MsgAddPackage) (err error) { | |||
} | |||
creatorAcc := vm.acck.GetAccount(ctx, creator) | |||
if creatorAcc == nil { | |||
return std.ErrUnknownAddress(fmt.Sprintf("account %s does not exist", creator)) | |||
return std.ErrUnknownAddress(fmt.Sprintf("account %s has not been initialized. does it have coins?", creator)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return std.ErrUnknownAddress(fmt.Sprintf("account %s has not been initialized. does it have coins?", creator)) | |
return std.ErrUnknownAddress(fmt.Sprintf("account %s does not exist or has not been initialized. does it have coins?", creator)) |
We still want the error to make sense if an address doesn't exist at all.
@@ -575,7 +575,7 @@ func (vm *VMKeeper) Run(ctx sdk.Context, msg MsgRun) (res string, err error) { | |||
// Validate arguments. | |||
callerAcc := vm.acck.GetAccount(ctx, caller) | |||
if callerAcc == nil { | |||
return "", std.ErrUnknownAddress(fmt.Sprintf("account %s does not exist", caller)) | |||
return "", std.ErrUnknownAddress(fmt.Sprintf("account %s has not been initialized. does it have coins?", caller)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return "", std.ErrUnknownAddress(fmt.Sprintf("account %s has not been initialized. does it have coins?", caller)) | |
return "", std.ErrUnknownAddress(fmt.Sprintf("account %s does not exist or has not been initialized. does it have coins?", caller)) |
@@ -336,7 +336,7 @@ func (vm *VMKeeper) AddPackage(ctx sdk.Context, msg MsgAddPackage) (err error) { | |||
} | |||
creatorAcc := vm.acck.GetAccount(ctx, creator) | |||
if creatorAcc == nil { | |||
return std.ErrUnknownAddress(fmt.Sprintf("account %s does not exist", creator)) | |||
return std.ErrUnknownAddress(fmt.Sprintf("account %s has not been initialized. does it have coins?", creator)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's a rhetorical question - accounts that don't exist don't have coins.
I'd prefer something like account %s does not exist, it must receive coins to be created
so we point the user to a clearer problem and solution
Description
Fixes #4165